package com.sxhuayuan.parking.service;

import com.sxhuayuan.parking.compenent.Page;
import com.sxhuayuan.parking.compenent.Pageable;
import com.sxhuayuan.parking.entity.Order;
import com.sxhuayuan.parking.entity.ParkingIn;
import com.sxhuayuan.parking.entity.ParkingInOut;

import java.util.Date;

public interface ParkingInOutService extends BaseService<ParkingInOut, Long> {

	/**
	 * 保存出场记录。缴费了不一定出场，可以多次缴费后出场，出场时必须没有再产生费用
	 * 
	 * @param in
	 *            入场记录
	 * @param outTime
	 *            出场时间
	 * @param exitId
	 *            出口Id
	 * @return 出场记录
	 */
	ParkingInOut out(ParkingIn in, Date outTime, Long exitId);

	ParkingInOut out(ParkingIn in, Date outTime, Long exitId, String lotRecordId);

	ParkingInOut out(ParkingIn in, ParkingInOut out);

	ParkingInOut findByUniqueId(Long uniqueId);

	ParkingInOut findByParkingLotIdAndLotRecordId(Long lotId, String recordId);

	int countByParkingLotIdAndLotRecordId(Long lotId, String recordId);

	ParkingInOut findByInTimeAndParkingLotIdAndCarPlate(Date inTime, Long parkId, String carPlate);

	ParkingInOut outMerge(ParkingIn in, Date outTime, Order order);

	ParkingInOut findByParkingLotIdAndCarPlateOne(Long lotId, String carPlate);

	/** 分页查询 */
	Page<ParkingInOut> findByPage(Pageable pageable);

}